
public class Wallet {
    // max possible # of banknotes in a wallet

    private static final int MAX = 10;
    private int contents[];
    private int count; // count # of banknotes stored in contents[]

    public Wallet() {
        //initialize the wallet to empty
        contents = new int[MAX];
        count = 0;
    }

    public void addBanknote(int banknoteType) {
        //adds a bank note to the wallet
        contents[count] = banknoteType;
        count++;
    }

    public String toString() {
        //prints out what is in the wallet
        StringBuffer sb = new StringBuffer();
        sb.append("Wallet[");
        for (int i = 0; i < count; i++) {
            sb.append(contents[i]);
            if (i != count - 1) {
                sb.append(",");
            }
        }
        sb.append("]");
        String output = new String(sb);
        return output;
    }

    public int value() {
        //adds up the contents in the wallet
        int value = 0;
        for (int i = 0; i < contents.length; i++) {
            value = value + contents[i];
        }
        return value;
    }

    public void reverse() {
        //reverses the order of the wallet
        int index2 = count - 1;
        for (int i = 0; i < contents.length; i++) {
            if (i <= index2) {
                int temp = contents[i];
                contents[i] = contents[index2];
                contents[index2] = temp;
                index2--;
            } else {
                index2--;
            }
        }
    }

    public void transfer(Wallet donor) {
        //transfers the donor contents into the receivers wallet
        for (int i = 0; i < donor.count; i++) {
            addBanknote(donor.contents[i]);
        }
        donor.count = 0;
    }

    public boolean sameBanknotesSameOrder(Wallet other) {
        //returns whether two wallets have the same banknotes in exactly the same order
        for (int i = 0; i < contents.length; i++) {
            if (other.contents[i] != contents[i]) {
                return false;
            }
        }
        return true;
    }
//EXTRA CREDIT methods follow...

    public void printBanknotePairs(Wallet other) {
// your code goes here
    }
}
